package com.b.domain;

import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

/**
    * 消息表
    */
@Document(indexName = "message")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Message {
    /**
    * 消息ID
    */
    @Id
    @Field(type = FieldType.Integer, index = true , store = true)
    private Integer id;

    /**
    * 发送人ID
    */
    @Field(type = FieldType.Integer, index = true , store = true)
    private Integer fromUserId;

    /**
    * 接收人ID
    */
    @Field(type = FieldType.Integer, index = true , store = true)
    private Integer toUserId;

    /**
    * 消息内容
    */
    @Field(type = FieldType.Text, index = true , store = true)
    private String content;

    /**
    * 消息类型（文本/图片/系统）
    */
    @Field(type = FieldType.Text, index = true , store = true)
    private String type;

    /**
    * 私聊/群聊
    */
    @Field(type = FieldType.Text, index = true , store = true)
    private String messageType;

    /**
    * 发送时间
    */
    @Field(type = FieldType.Date, index = false , store = true)
    private Date sendTime;

    /**
    * 发送者
    */
    @Field(type = FieldType.Text, index = true , store = true)
    private String senderRole;
    /**
    * 接收者
    */
    @Field(type = FieldType.Text, index = true , store = true)
    private String receiverRole;
}